<template>
	<view class="my-settle-container">
		<!-- 全选区 -->
		<label class="radio" @click="changeAllGoodsStatus">
			<radio color="#C00000" :checked="isFullCheck" /> <text>全选</text>
		</label>
		<!-- 合计 -->
		<view class="amout-box">
			合计： <text class="amout">￥{{checkedGoodsAmount}}</text>
		</view>
		<!-- 结算 -->
		<view class="btn-settle">
			结算({{checkedCount}})
		</view>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		name: "my-settle",
		computed: {
			...mapGetters('m_cart', ['checkedCount', 'total','checkedGoodsAmount']),
			//判断 总数量是否和被选中的数量一致，那么就是全选状态
			isFullCheck() {
				return this.total === this.checkedCount
			}

		},
		data() {
			return {

			};
		},
		methods: {
			...mapMutations('m_cart', ['updAllGoodsState']),
			changeAllGoodsStatus() {
				//将所有的商品的取反
				this.updAllGoodsState(!this.isFullCheck)
		}
	}
	}
</script>

<style lang="scss">
	.my-settle-container {
		background-color: white;
		/* 底部固定定位 */
		position: fixed;
		bottom: 0;
		left: 0;
		/* 设置宽高 */
		width: 100%;
		height: 50px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 14px;
		padding-left: 5px;

		.radio {
			display: flex;
			align-items: center;
		}

		.amout-box {
			.amout {
				color: #c00000;
				font-weight: bold;
			}
		}

		.btn-settle {
			height: 50px;
			min-width: 100px;
			padding: 0, 10px;
			height: 50px;
			line-height: 50px;
			background-color: #c00000;
			text-align: center;
			color: white;
			font-weight: bold;
		}

	}
</style>
